package io.jjz.consts;

public enum MerchType {
    ALL("ALL", "00"),
    DG("DG", "03"),
    LS("LS", "01");

    private String name;
    private String id;

    MerchType(String name, String id) {
        this.name = name;
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public String getId() {
        return id;
    }

    public static boolean isValid(String value) {
        if (value == null) {
            return false;
        }
        MerchType[] values = MerchType.values();
        for (MerchType e : values) {
            if (e.name.equals(value)) {
                return true;
            }
        }
        return false;
    }

    public static String getIdByName(String id) {
        if (id == null) {
            return null;
        }
        MerchType[] eSet = MerchType.values();
        for (MerchType e : eSet) {
            if (e.id.equals(id)) {
                return e.name;
            }
        }
        return "";
    }
}
